public class School {
    //成员变量 name library num
    private String name;
    private int num;
    //1.静态变量初始化的第一种方式  显示初始化
    public static String library="";//共享属性

    //2.静态变量初始化的第二种方式  静态代码块
    static{
        library="";
    }

    //get/set方法
    public String getName() {
        return name;
    }

    public String getLibrary() {
        return library;
    }

    public int getNum() {
        return num;
    }

    public void setLibrary(String library) {
        //通过对象调用共享属性
        School.library=library;

    }

    //无参构造器
    public School(){

    }

    //全参构造器
    public School(String name,String library,int num){
        this.name=name;
        this.library = library;
        this.num=num;
    }

    //show方法
    public void show(){
        System.out.println("schoolname:"+name);
        System.out.println("schoollibrary:"+library);
        System.out.println("studentnum:"+num);
    }
}
